package com.jdz.controller.backend;

import com.jdz.common.ServerResponse;
import com.jdz.pojo.RaceTypeSamsara;
import com.jdz.service.IRaceTypeDetailsService;
import com.jdz.service.IRaceTypeSamsaraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/manage/racetypesamsara")
public class RaceTypeSamsaraManageController {

    @Autowired
    IRaceTypeSamsaraService iRaceTypeSamsaraService;


    /**
     * 列出本项目类型的所有比赛等级
     * @param racetypeno
     * @return
     */
    @RequestMapping(value = "list_racetype_samsara.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse listRaceTypeSamsara(@RequestParam("racetypeno") Integer racetypeno){

        return iRaceTypeSamsaraService.listRaceTypeSamsara(racetypeno);
    }


    /**
     * 添加比赛等级
     * @param raceTypeSamsaraForm
     * @return
     */
    @RequestMapping(value = "add.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse add(RaceTypeSamsara raceTypeSamsaraForm){
        return iRaceTypeSamsaraService.add(raceTypeSamsaraForm);
    }

    /**
     * 修改比赛等级名字，只接收数据库id和修改后的项目名称
     * @param raceTypeSamsaraForm
     * @return
     */
    @RequestMapping(value = "update.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse update(RaceTypeSamsara raceTypeSamsaraForm){
        return iRaceTypeSamsaraService.update(raceTypeSamsaraForm);
    }

    /**
     * 删除项目类型比赛等级
     * @param racetypesamsarano
     * @return
     */
    @RequestMapping(value = "delete.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse delete(Integer racetypesamsarano){
        return iRaceTypeSamsaraService.delete(racetypesamsarano);
    }

    /**
     * 开始轮次投票
     * @param racetypesamsarano
     * @return
     */
    @RequestMapping(value = "ballot_start.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse ballotStart(Integer racetypesamsarano){
        return iRaceTypeSamsaraService.ballotStart(racetypesamsarano);
    }

    /**
     * 结束轮次投票
     * @param racetypesamsarano
     * @return
     */
    @RequestMapping(value = "ballot_stop.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse ballotStop(Integer racetypesamsarano){
        return iRaceTypeSamsaraService.ballotStop(racetypesamsarano);
    }

    /**
     * 设置投票开始时间
     * @param racetypesamsarano
     * @param startTime
     * @return
     */
    @RequestMapping(value = "setballot_start.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse setballotStart(Integer racetypesamsarano,String startTime){
        return iRaceTypeSamsaraService.setballotStart(racetypesamsarano,startTime);
    }

    /**
     * 设置投票结束时间
     * @param racetypesamsarano
     * @param stopTime
     * @return
     */
    @RequestMapping(value = "setballot_stop.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse setballotStop(Integer racetypesamsarano,String stopTime){
        return iRaceTypeSamsaraService.setballotStop(racetypesamsarano,stopTime);
    }
}
